// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-6-24

#ifndef __PAGECTRL_H_COMMON_UI__
#define __PAGECTRL_H_COMMON_UI__

#pragma once

#include "wndcontainer.h"
#include "checkbox.h"

class CJoyPageCtrl;
class CJoyPageContainer;
class CJoyPageTabSet;

//##ModelId=44CF17B60168
class CJoyPageContainer : public CJoyWndContainer
{
	DECLARE_DYNAMIC(CJoyPageContainer)
protected:
    friend class CJoyPageCtrl;
    friend class CJoyPageTabSet;

	//##ModelId=44CF17B6016B
    CJoyPageCtrl*   m_pageCtrl;

public:
	//##ModelId=44CF17B60177
    CJoyPageContainer();
	//##ModelId=44CF17B60178
    virtual ~CJoyPageContainer(void);
public:
    DECLARE_MESSAGE_MAP()
};

//##ModelId=44CF17B6017B
class CJoyPageTabSet : public CJoyWnd
{
	DECLARE_DYNAMIC(CJoyPageTabSet)
protected:
    friend class CJoyPageCtrl;
    friend class CJoyPageContainer;

	//##ModelId=44CF17B60187
    CJoyPageCtrl*   m_pageCtrl;

public:
	//##ModelId=44CF17B6018B
    CJoyPageTabSet();
	//##ModelId=44CF17B6018C
    virtual ~CJoyPageTabSet(void);
public:
    DECLARE_MESSAGE_MAP()
	//##ModelId=44CF17B6018F
    afx_msg void OnSize(UINT nType, int cx, int cy);
};

//##ModelId=44CF17B601A5
class CJoyPageCtrl : public CJoyWnd
{
	DECLARE_DYNAMIC(CJoyPageCtrl)
public:
    friend class CJoyPageContainer;
    friend class CJoyPageTabSet;

	//##ModelId=44CF17B60222
    class CPageItem
    {
    public:
		//##ModelId=44CF17B60224
        CJoyCheckBox*   m_tab;
		//##ModelId=44CF17B60229
        CJoyWnd*        m_page;
		//##ModelId=44CF17B60232
        CString         m_name;
		//##ModelId=44CF17B60233
        CPageItem()
            : m_tab(NULL), m_page(NULL)
        {
        }
    };

	//##ModelId=44CF17B601A8
    unsigned    m_tabSpace;
	//##ModelId=44CF17B601AC
    int         m_tabStart;
	//##ModelId=44CF17B601B6
    CList<CPageItem>    m_items;
	//##ModelId=44CF17B601BB
    CJoyPageContainer*  m_container;
	//##ModelId=44CF17B601C0
    CJoyPageTabSet*     m_tabSet;
	//##ModelId=44CF17B601C6
    CJoyCheckGroup      m_tabGroup;

	//##ModelId=44CF17B601CA
    POSITION GetItemPos(const CString& name);
	//##ModelId=44CF17B601CC
    void BuildTabArea();

	//##ModelId=44CF17B601CD
    void BuildTabAreaLeft();
	//##ModelId=44CF17B601D4
    void BuildTabAreaTop();
	//##ModelId=44CF17B601D5
    void BuildTabAreaRight();
	//##ModelId=44CF17B601D6
    void BuildTabAreaBottom();

	//##ModelId=44CF17B601D7
    virtual CJoyPageContainer* CreateContainer();
	//##ModelId=44CF17B601D9
    virtual CJoyPageTabSet* CreateTabSet();

	//##ModelId=44CF17B601E5
    virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44CF17B601E8
    virtual void OnSelTab(CJoyCheckBox* box, bool& checked);
public:
	//##ModelId=44CF17B601F4
    CJoyPageCtrl(void);
	//##ModelId=44CF17B601F6
    virtual ~CJoyPageCtrl(void);

	//##ModelId=44CF17B601F9
    void AddPage(const CString& name, CJoyWnd* page);
	//##ModelId=44CF17B60204
    CJoyWnd* RemovePage(const CString& name);

	//##ModelId=44CF17B60206
    void ShowPage(const CString& name, bool show);
	//##ModelId=44CF17B60214
    void SelectPage(const CString& name);
public:
    DECLARE_MESSAGE_MAP()
	//##ModelId=44CF17B60216
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};


#endif  // __PAGECTRL_H_COMMON_UI__
